function sum=f1(n)
sum=0;
tmp=1;
for i=1:n
    tmp=tmp*i
    sum=sum+tmp;
end
end